<script src="../asynx.js"></script>
<script src="../dom/dom.js"></script>
<script src="../impl/array.js"></script>
<script src="../impl/util.js"></script>
<script src="../impl/cookie.js"></script>
<script src="../impl/ajax.js"></script>
<script src="../impl/lang.js"></script>
<script src="../dom/xpath.js"></script>
<script src="../dom/selector.js"></script>
<script src="../event/event.js"></script>

<script src="../plugins/drag/drag.js"></script>
<script src="../plugins/animation/anim.js"></script>
<script src="../plugins/datalist/datalist.js"></script>
<script src="../plugins/autocomplete/autocomplete.js"></script>


<h1>asynx autocomplete</h1>

<style>
	
	div * {
		font-family: Arial;
		font-size: 12px;
	}
	
	.snippet {
		font-style:italic;
		font-size: 10px;
		float:right;
	}
	
</style>

<input type='text' id="teste1" size='40'>

<input type='text' id="teste2" size='70'>

<div id="ACcontainer1">Container</div>
<div id="ACcontainer2">Container</div>
<div id="log" class="a">Log<br></div>


<script>


	var dataGrid = [
		[ { text: "Coluna1 xc fdsg dfg sdfg sdfg sdfg sdfg sdfg sdfg" }, { text: "Coluna2" }, { text: "Coluna3" } ],
		[ { text: "Coluna1", value: "coluna" }, { text: "Coluna2", value: "coluna" } ],
		[ { text: "Coluna1" }, { text: "Coluna2" }, { text: "Coluna3" }, { text: "Coluna4" } ]
	];
	
	
	/*var dataSource = new asynx.datalist.DataSourceJSON(dataGrid);
	dataSource.maxResults = 20;
	dataSource.cache = true;
	dataSource.filterByFields = [ "text", "value" ];*/
	
	var DSAjax1 = new asynx.datalist.DataSourceAJAX("datalist.php", "json", { aa: "dd"});
	DSAjax1.maxResults = 30;
	DSAjax1.cache = true;
	DSAjax1.filterByFields = [ "text", "value" ];
	
	var DSAjax2 = new asynx.datalist.DataSourceAJAX("datalist.php", "json", { aa: "dd"});
	DSAjax2.maxResults = 20;
	DSAjax2.cache = false;
	DSAjax2.filterByFields = [ "text", "value" ];
	
	var suggest1 = new asynx.autocomplete({
		
		input: 'teste1',
		
		container: 'ACcontainer1',
		
		multiple: true,
		
		gridLayout: true,
		
		fastRender: true,
		
		data: DSAjax1
		
	});

	
	suggest1.setWidth('500px');
	suggest1.setHeight('200px');
	
	suggest1.setRowCss("row");
	
	suggest1.onStopTyping = function(e) {
		log("acabou de escrever")
	};
	
	suggest1.enableEffects();
	
	
	
	var suggest2 = new asynx.autocomplete({
		
		input: 'teste2',
		
		container: 'ACcontainer2',
		
		multiple: true,
		
		fastRender: false,
		
		data: DSAjax2
		
	});
	
	
	
</script>
